import 'package:eye_flutter_app/provider/cart.dart';
import 'package:eye_flutter_app/provider/test.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'routers/router.dart';
// 引入provider
import 'package:provider/provider.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  MyApp({Key? key}) : super(key: key);

  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
        // 屏幕适配
        designSize: Size(1440, 900), //配置设计稿的宽度高度
        builder: () => MultiProvider(
                // 配置Provider
                providers: [
                  ChangeNotifierProvider(create: (_) => TestProvider()),
                  ChangeNotifierProvider(create: (_) => CartProvider())
                ],
                child: MaterialApp(
                  // home: Tabs(),
                  initialRoute: '/',
                  onGenerateRoute: onGenerateRoute,
                  theme: ThemeData(fontFamily: 'BalooBhai2'), // 设置项目全局字体
                )));
  }
}
